import Vue from 'vue'
import VueRouter from 'vue-router'
const Constant = require('@/api/constants').default
Vue.use(VueRouter)
const baseRoutes = [{
    path: '/',
    name: 'base',
    redirect: {
      name: Constant.redirect
    }
  }
]
const routesInfo = {
  
}
const mainRoutes = [{
  path: `/${Constant.redirect}`,
  name: Constant.redirect,
  component: () => import(`@/views/${Constant.redirect}.vue`),
  meta: routesInfo[Constant.redirect]
}]
const routes = baseRoutes.concat(mainRoutes)

const router = new VueRouter({
  routes
})

router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})

export default router